//
//  zhibanViewController.m
//  shifaOASystem
//
//  Created by michael on 2017/11/21.
//  Copyright © 2017年 czd. All rights reserved.
//

#import "zhibanViewController.h"

@interface zhibanViewController ()

@end

@implementation zhibanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"值班查询";
        self.view.backgroundColor = [UIColor whiteColor];
         _button1 = [[UIButton alloc] initWithFrame:CGRectMake(10, 5, (KScreenWidth-30)/2, 20)];
    [_button1 setTitle:@"上一周" forState:UIControlStateNormal];
//   _button1.backgroundColor = [UIColor redColor];
   [_button1 addTarget:self action:@selector(buttonAction1) forControlEvents:UIControlEventTouchUpInside];
          [_button1.layer setBorderColor:[UIColor blackColor].CGColor];
    [_button1.layer setBorderWidth:1];
 [_button1.layer setMasksToBounds:YES];
   [_button1 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        _button1.layer.cornerRadius = _button1.height/2;
//[_button1 setImage:[UIImage imageNamed:@"下拉@2x"] forState:UIControlStateNormal];
[_button1 layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleRight
                        imageTitleSpace:10];
//    _button1.layer.shadowOffset = CGSizeMake(1,1);
//    _button1.layer.shadowOpacity = 0.3;
//    _button1.layer.shadowColor = [UIColor blackColor].CGColor;
//    [self.view addSubview:_button1];

_button2 = [[UIButton alloc] initWithFrame:CGRectMake(_button1.right+10, 5, (KScreenWidth-30)/2, 20)];
       [_button2 setTitle:@"下一周" forState:UIControlStateNormal];


      [_button2.layer setBorderColor:[UIColor blackColor].CGColor];
    [_button2.layer setBorderWidth:1];
 [_button2.layer setMasksToBounds:YES];
   [_button2 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
   [_button2 addTarget:self action:@selector(buttonAction2) forControlEvents:UIControlEventTouchUpInside];
        _button2.layer.cornerRadius = _button2.height/2;
//    _button2.layer.shadowOffset = CGSizeMake(1,1);
//    _button2.layer.shadowOpacity = 1;
//    _button2.layer.shadowColor = [UIColor blackColor].CGColor;
//   _button2.backgroundColor = [UIColor redColor];
//    [self.view addSubview:_button2];

//    _webview = [[UIWebView alloc]initWithFrame:CGRectMake(0, 30, KScreenWidth, KScreenHeight-kTopHeight-30)];
    _webview = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight-kTopHeight-0)];

      _webview.delegate=self;
    _webview.scrollView.bounces=NO;

      _webview.scalesPageToFit = YES;
      [self.view addSubview:_webview];
       NSString * userId = [[NSUserDefaults standardUserDefaults]objectForKey:@"userId"];
    NSArray *  array = @[@{@"sName":userId}];;
      [HttpTools postWithURL:KExchother arrays:array method:Koncall success:^(id JSON) {
   
        NSString *string = JSON;
                   NSURL *url = [NSURL URLWithString:string];

    NSData *data = [NSData dataWithContentsOfURL:url];
    [_webview loadData:data MIMEType:@"text/html" textEncodingName:@"GBK" baseURL:url];



    } failure:^(NSError *error) {
        
    }];
//        NSURL *url = [NSURL URLWithString:self.url];
//          [_webview loadRequest:[NSURLRequest requestWithURL:url]];

    // Do any additional setup after loading the view.
}
- (void)buttonAction1{

 
 }

 - (void)buttonAction2{

 

 }
-(void)webViewDidFinishLoad:(UIWebView *)webView{
NSString *injectionJSString = @"var script = document.createElement('meta');"
"script.name = 'viewport';"
"script.content=\"width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.01, user-scalable=no\";"
"document.getElementsByTagName('head')[0].appendChild(script);";
[webView stringByEvaluatingJavaScriptFromString:injectionJSString];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
